<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
	<title></title>
</head>
<script type="text/javascript">
	var flag=0;
	var timeID;
	function beg(){
		var i=form1.num.value;
		i++;
		form1.num.value=i;
		timeID=setTimeout("beg()",1000);
	}
	function sta(){
		if(flag==0){
			beg();
			flag=1;
		}
	}
	function pau(){
		clearTimeout(timeID);
		flag=0;
	}
</script>
<body>
<form id="form1" name="form1" method="post" action="">
	<input type="text" name="num" size="1" value="0" />
	<input type="button" name="start" value="开始计时" onClick="sta();" />
	<input type="button" name="pause" value="暂停计时" onClick="pau();" />
</form>
</body>
</html>